package flc.ast.adapter;


import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.FishBean;
import flc.ast.bean.WishBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class FishAdapter extends StkProviderMultiAdapter<FishBean> {

    public FishAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new FishProvider());
    }

    private class FishProvider extends BaseItemProvider<FishBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_fish;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, FishBean bean) {
            baseViewHolder.setImageResource(R.id.ivFishItemImg, bean.getImg());
            if (bean.isSelected()) {
                baseViewHolder.getView(R.id.ivFishItemSel).setVisibility(View.VISIBLE);
            } else {
                baseViewHolder.getView(R.id.ivFishItemSel).setVisibility(View.GONE);
            }
        }
    }

}
